package com.jacquesh;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class FlinkDemo0014 {
    public static void main(String[] args) throws Exception {
                StreamExecutionEnvironment environment =
                        StreamExecutionEnvironment.getExecutionEnvironment();
                /**设置默认并行度为4*/
                environment.setParallelism(4);
                /**获取随机数流 ： 1~10*/
                DataStreamSource<Long> stream = environment.generateSequence(1,10)
                        /**并行度设置为1*/
                        .setParallelism(1);
                stream.rebalance().print();
                environment.execute("rebalance");
            }
 }
